<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require './src/Exception.php';
require './src/PHPMailer.php';
require './src/SMTP.php';

$mail = new PHPMailer(true);
try {
    //服务器配置
    $mail->CharSet = "UTF-8";
    $mail->SMTPDebug = 0;
    $mail->isSMTP();
    $mail->Host = 'smtp.163.com';
    $mail->SMTPAuth = true;
    $mail->Username = 'drcomsql@163.com';
    $mail->Password = 'drcom123';
    $mail->SMTPSecure = 'ssl';
    $mail->Port = 465;

    $mail->setFrom('drcomsql@163.com', 'Iplook');  //发件人
    $mail->addAddress($_GET['to'], 'client');  // 收件人

    //Content
    $mail->isHTML(true);
    $mail->Subject = $_GET['title'];
    $mail->Body = $_GET['content'];
    $mail->send();
    echo 1;
} catch (Exception $e) {
    echo 0;
    file_put_contents('error.log', $mail->ErrorInfo, 8);
}